<template>
  <div class="hello">
    <h2>使用node.js编写接口</h2>
    <div class="tablelist">
      <div class="tablelist_content">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="class" label="班级" width="auto">
          </el-table-column>
          <el-table-column prop="name" label="姓名" width="auto">
          </el-table-column>
          <el-table-column prop="sex" label="性别" width="auto">
          </el-table-column>
          <el-table-column prop="address" label="地址">
          </el-table-column>
        </el-table> 
      </div>
    </div>

  </div>
</template>

<script>
import axios from 'axios';
export default {
  name: 'hello',
  created() {
    axios.post('http://localhost:8080/api/getStudentListInfo')
      .then((response) => {
        this.tableData = response.data;
        console.log(response);
        // alert("success");
      })
      .catch((error) => {
        // alert('failure', error);
        console.log('issues 页面出错了', error);
    });
  },
  data () {
    return {
      tableData: []
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}

.tablelist {
  padding: 20px;
  text-align: center;
}

.tablelist_content {
  max-width: 800px;
  margin: 0 auto;
}

</style>
